package com.algorithm.leetcode;

/**
 * @author liyanhao
 * @Date 2023-07-03 15:33
 */
public class LeetCode10 {
    public static void main(String[] args) {
        LeetCode10 solution =  new LeetCode10();
        String s = "aaaa";
        String p = "a*";
        solution.isMatch(s, p);
        System.out.println(solution.isMatch(s, p));
    }


    public boolean isMatch(String s, String p) {
        if (s == null || p == null) {
            return false;
        }
        int slen = s.length();
        int plen = p.length();
        if(slen == 1){
            if(plen==1){
                return s.equals(p);
            }else {
                return false;
            }
        }
        if (plen == 1) {
            if (p.charAt(1) == '*') {
                return true;
            }else if(p.charAt(0) == s.charAt(0)){
                return true;
            }else {
                return false;
            }
        }
        return false;
    }

}